package org.deltaset.secured.visit.menu;


import java.util.ArrayList;
import java.util.List;
import javax.annotation.ManagedBean;
import javax.inject.Inject;
import org.deltaset.desktop.MenuGroup;
import org.deltaset.desktop.MenuItem;
import org.deltaset.secured.menu.MenuRegistry;

/**
 *
 * @author dmakariev
 */
@ManagedBean
public class LibraryMenu {

    private final static String ENTITY_SRC = "/record/meta-entity.xhtml";
    private final MenuRegistry menuRegistry;

    @Inject
    public LibraryMenu(MenuRegistry menuRegistry) {
        this.menuRegistry = menuRegistry;
        this.menuRegistry.getTopMenu().get(0).getMenuGroups().addAll(initMiniHome());
    }

    private List<MenuGroup> initMiniHome() {        
        final List<MenuGroup> menuGroups = new ArrayList<MenuGroup>();
        menuGroups.add(MenuRegistry.autoObjects("Visit", "org.deltaset.secured.visit"));
        menuGroups.add(MenuRegistry.autoObjects("Uploaded Files", "org.deltaset.secured.upload"));
        menuGroups.add(MenuRegistry.autoObjects("Collection Examples", "org.deltaset.secured.example"));
        menuGroups.add(fileUpload());
//        menuGroups.add(new MenuGroup("Record").add(Person.class, ENTITY_SRC).
//                add(Animal.class, ENTITY_SRC));

        return menuGroups;
    }
    
    private MenuGroup fileUpload(){
        final MenuItem defaultMenuItem = new MenuItem("File upload", "/fileupload.xhtml");
        final MenuGroup simple = new MenuGroup("Files");
        simple.add(defaultMenuItem);
        return simple;
    }
    //private List<MenuGroup> initMiniHome() {
    //    final List<MenuGroup> menuGroups = new ArrayList<MenuGroup>();
    //    menuGroups.add(new MenuGroup("visit").add(Person.class, ENTITY_SRC).
    //            add(Animal.class, ENTITY_SRC));
    //    return menuGroups;
    //}
}
